package com.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.entity.pojo.LfCase;
import com.entity.pojo.LfLawyer;
import com.entity.pojo.LfRecruitment;
import com.entity.pojo.LfUser;
import com.entity.vo.FigureVo;
import com.mapper.LfCaseMapper;
import com.mapper.LfLawyerMapper;
import com.mapper.LfRecruitmentMapper;
import com.mapper.LfUserMapper;
import com.service.DashboardService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("DashboardService")
public class DashboardServiceImpl implements DashboardService {

    @Resource
    private LfUserMapper userMapper;

    @Resource
    private LfCaseMapper caseMapper;

    @Resource
    private LfLawyerMapper lawyerMapper;

    @Resource
    private LfRecruitmentMapper recruitmentMapper;

    @Override
    public FigureVo getData() {
        return new FigureVo()
                .setCaseNumber(caseMapper.selectCount(new QueryWrapper<LfCase>().eq("deleted", 0)))
                .setUserNumber(userMapper.selectCount(new QueryWrapper<LfUser>().eq("deleted", 0)))
                .setRecruitmentNumber(recruitmentMapper.selectCount(new QueryWrapper<LfRecruitment>().eq("deleted", 0)))
                .setLawyerNumber(lawyerMapper.selectCount(new QueryWrapper<LfLawyer>().eq("deleted", 0)));

    }
}
